import cv2
import numpy as np
from matplotlib import pyplot as plt
import random,time
from PIL import ImageGrab
import pyautogui
import cv2
import numpy as np
import time

def 找到图片位置并点击(img):
    zhuangtai= pyautogui.locateOnScreen(img)
    if zhuangtai!=None:
        x, y = pyautogui.center(zhuangtai)  # 获得中心点
        print( "找到位置了，并点击")
        pyautogui.moveTo(x, y)  # 鼠标移动到坐标位置
        pyautogui.click(x, y)  # 鼠标点击
        return (x,y)
    return zhuangtai
def 找到图片位置(img):
    zhuangtai= pyautogui.locateOnScreen(img)
    if zhuangtai!=None:
        x, y = pyautogui.center(zhuangtai)  # 获得中心点
        print( "找到位置了")
        # pyautogui.moveTo(x, y)  # 鼠标移动到坐标位置
        # pyautogui.click(x, y)  # 鼠标点击
        return (x,y)
    return zhuangtai